package org.hcf.data.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.hcf.data.entity.ChatUser;
import org.hcf.data.mapper.ChatUserMapper;
import org.hcf.data.service.IChatUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author xianiyitiao
 * @since 2024-04-18
 */
@Service
public class ChatUserServiceImpl extends ServiceImpl<ChatUserMapper, ChatUser> implements IChatUserService {

    @Override
    public ChatUser getUserByPhone(String phone) {
        return getOne(new LambdaQueryWrapper<ChatUser>().eq(ChatUser::getPhone, phone));
    }

    @Override
    public ChatUser getUserByAccount(String account) {
        return getOne(new LambdaQueryWrapper<ChatUser>().eq(ChatUser::getAccount, account));
    }

    @Override
    public List<ChatUser> getUserByIds(Long[] ids) {
        return list(new LambdaQueryWrapper<ChatUser>().in(ChatUser::getUserId, ids));
    }
}
